<!-- <template>
		
</template> -->

<!-- <renew style="width: 50%;height: 50%; "></renew> -->

<script>
	import store from 'store/index.js'
	// import {
	// 	univerifyLogin
	// } from '@/common/js/univerify.js'
	import renew from '@/components/common/renew/renew.vue'
	import {
		compareVersion,
		downWgt,
		installWgt
	} from '@/components/common/renew/renew.js'
	import {
		selectThreeKilometersByNurseId
	} from '@/apis/order/index.js'
	//对比版本号    创建下载对象 安装
	export default {
		// globalData: {
		// 	store
		// },
		onShow() {
			this.selectThreeKilometersByNurseId()
			
		},
		onHide() {
			
		},
		onError: function(e) {
			console.log(e, 'eeeeeeeeeeeeeeeeeeeeeeee')
		},
		// 首次进入APP执行
		onLaunch: function() {
			console.log("执行”")


			// push
			// #ifdef APP-PLUS  
			setTimeout(() => {
				plus.push.getClientInfoAsync((info) => {
					let cid = info["clientid"];
					console.log("cid是---------------------x：" + cid);
					store.commit('mycid', cid)
				});
			}, 1000)

			const _self = this;
			const _handlePush = function(message) {
				setTimeout(() => {
					uni.switchTab({
						url: '/pages/index/index'
					})
				}, 1000)
			};
			plus.push.addEventListener('click', _handlePush);
			plus.push.addEventListener('receive', this.handlePush);
			// #endif  

			console.log('APPonhow')

			// #ifdef APP
			plus.screen.lockOrientation('portrait-primary'); //锁定屏幕方向

			// #endif

			// 手机号预登陆校验


			//检测手机切换成横屏的时候，此时首页布局切换为竖屏的时候页面布局会混乱。

		},
		methods: {
			selectThreeKilometersByNurseId() {
				console.log("token====",this.$store.state.token)
				if(this.$store.state.token) {
					let params = {
						nurseId: this.$store.state.userInfo.id
					}
					selectThreeKilometersByNurseId(params).then(res=>{
						console.log("订单状态APP========",res)
						if(res.success) {
							this.$store.dispatch('continuousReportLocation', {
								orderNumber: res.object
							})
						}
					})
				}
			},
			handlePush(msg) {
				let {
					payload = ''
				} = msg
				console.log(msg, '4444444444444')
				//  msg.type == 'receive' ||
				if (uni.getSystemInfoSync().platform != 'ios') {
					var options = {
						cover: false,
						title: msg.title,
						payload: msg.payload
					}

					var url = `/pages/index/index`
					plus.push.createMessage(msg.content, url, options)

				} else {
					if (msg.type == 'receive') {
						console.log(msg, '5555555555555')
						var options = {
							cover: false,
							title: msg.title,
							payload: msg.payload
						}
						var url = `/pages/index/index`
						plus.push.createMessage(msg.content, url, options)
					}
					//  if(msg.content){
					// var options = { cover: false, title:msg.payload.title }
					// var url = `/pages/index/index`
					// plus.push.createMessage(msg.payload.content, url, options)
					// }
				}

			},
			moveTo() {
				uni.navigateTo({
					url: './pages/guide/guide/guide'
				})
			},
			APPinit() {
				let data = {}
				// 1 获取手机系统信息
				let res = uni.getSystemInfoSync()
				console.log(res, '手机系统信息是');
				data.platform = res.platform //手机
				data.brand = res.brand //手机品牌
				data.statusBarHeight = res.statusBarHeight //状态栏高度

				data.windowHeight = res.windowHeight //手机可视区域高度

				// 2.网络状态
				uni.getNetworkType({
					success(res) {
						// console.log(res,'当前网络状态是');
						if (res.networkType == 'none') {
							// 没有网络
							data.network = false
							plus.nativeUI.toast('服务器网络异常，请稍后重试')
							// uni.showToast({
							//     title:'服务器或网络异常，请稍后重试。',
							//     icon:'none'
							// })
						} else {
							data.network = true
						}
					}
				})

				store.commit('setSystem', data)

				// 3. 手机设备唯一标识号
				// #ifdef APP
				plus.device.getInfo({
					success(res) {
						console.log(res, '设备唯一标识号');
						let uuid = res.uuid
						store.commit('setUuid', uuid)
					}
				})
				// #endif


			},

		},
		components: {

		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	/* 公共样式 */
	@import url('@/common/css/common.css');
	@import url('@/common/css/public.css');
	/* UI基础库 */
	@import url('@/common/css/free.css');

	/* 引入iconfont */
	@import url('@/common/fonts/iconfont.css');
</style>